﻿using System.Collections.Generic;

namespace CSW.Framework.Windows.ActiveDirectory
{
    /// <summary>
    /// Active Directory Uesr
    /// </summary>
    public class User
    {
        private List<string> m_MemberOf;

        /// <summary>
        /// Gets the name of the login.
        /// </summary>
        /// <value>The name of the login.</value>
        public string LoginName { get; internal set; }

        /// <summary>
        /// Gets the display name.
        /// </summary>
        /// <value>The display name.</value>
        public string DisplayName { get; internal set; }

        /// <summary>
        /// Gets the mail.
        /// </summary>
        /// <value>The mail.</value>
        public string Mail { get; internal set; }
        
        /// <summary>
        /// Gets the member of.
        /// </summary>
        /// <value>The member of.</value>
        public List<string> MemberOf
        {
            get 
            {
                if (m_MemberOf == null && MemberOfInternal != null)
                {
                    m_MemberOf = new List<string>(MemberOfInternal);
                    SAM.AddGroupsRecurisvely(m_MemberOf);
                }

                return m_MemberOf;
            }
        }
        
        /// <summary>
        /// Gets the name of the given.
        /// </summary>
        /// <value>The name of the given.</value>
        public string GivenName { get; internal set; }

        /// <summary>
        /// Gets the surname.
        /// </summary>
        /// <value>The surname.</value>
        public string Surname { get; internal set; }

        /// <summary>
        /// The literal memberof string.
        /// </summary>
        /// <value>The literal memberof string.</value>
        internal List<string> MemberOfInternal { get; set; }
    }
}